Delete saroute for nonuse.
authorRobert Lipe <robertlipe@gmail.com>
Thu, 17 Mar 2022 01:22:03 +0000 (20:22 -0500)
committerRobert Lipe <robertlipe@gmail.com>
Thu, 17 Mar 2022 01:22:03 +0000 (20:22 -0500)
12 files changed:
CMakeLists.txt
GPSBabel.pro
deprecated/saroute.cc [new file with mode: 0644]
reference/format0.txt
reference/format1.txt
reference/format2.txt
reference/format3.txt
reference/help.txt
saroute.cc [deleted file]
testo.d/saroute.test [deleted file]
vecs.cc
xmldoc/formats/saroute.xml [deleted file]

index a3d507614d30f1af39da5fb4203c3658178a477f..42973a4bdd438391e73dd8701a9d9ab8629c4ff3 100644 (file)
@@ -133,7 +133,6 @@ set(ALL_FMTS ${MINIMAL_FMTS}
   qstarz_bl_1000.cc
   random.cc
   raymarine.cc
-  saroute.cc
   sbn.cc
   sbp.cc
   shape.cc
index 7b3db46681489f5ad1226b68270ba3cf435b0929..dbe4cb0945a0f1acab10c93de81656a814de0b10 100644 (file)
@@ -108,7 +108,6 @@ ALL_FMTS = $$MINIMAL_FMTS \
   qstarz_bl_1000.cc \
   random.cc \
   raymarine.cc \
-  saroute.cc \
   sbn.cc \
   sbp.cc \
   shape.cc \
diff --git a/deprecated/saroute.cc b/deprecated/saroute.cc
new file mode 100644 (file)
index 0000000..24086a0
--- /dev/null
@@ -0,0 +1,420 @@
+/*
+    Read various Delorme routes including anr, rte, and rtd.
+
+    Copyright (C) 2003 Ron Parker and Robert Lipe.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+ */
+
+
+#define MYNAME "saroute"
+#include "defs.h"
+#include "grtcirc.h"
+#include <cstddef>
+
+static gbfile* infile;
+
+static char* turns_important = nullptr;
+static char* turns_only = nullptr;
+static char* controls = nullptr;
+static char* split = nullptr;
+static char* timesynth = nullptr;
+
+static int control = 0;
+
+static
+QVector<arglist_t> saroute_args = {
+  {
+    "turns_important", &turns_important,
+    "Keep turns if simplify filter is used",
+    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
+  },
+  {
+    "turns_only", &turns_only, "Only read turns; skip all other points",
+    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
+  },
+  {
+    "split", &split, "Split into multiple routes at turns",
+    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
+  },
+  {
+    "controls", &controls, "Read control points as waypoint/route/none",
+    "none", ARGTYPE_STRING, ARG_NOMINMAX, nullptr
+  },
+  {
+    "times", &timesynth, "Synthesize track times",
+    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
+  },
+};
+
+#define ReadShort(f) gbfgetint16(f)
+#define ReadLong(f) gbfgetint32(f)
+
+static unsigned char*
+ReadRecord(gbfile* f, gbsize_t size)
+{
+  auto* result = (unsigned char*) xmalloc(size);
+
+  (void)gbfread(result, size, 1, f);
+  return result;
+}
+
+static void
+Skip(gbfile* f, gbsize_t distance)
+{
+  gbfseek(f, distance, SEEK_CUR);
+}
+
+static void
+rd_init(const QString& fname)
+{
+  infile = gbfopen(fname, "rb", MYNAME);
+  if (split && (turns_important || turns_only)) {
+    fatal(MYNAME
+          ": turns options are not compatible with split\n");
+  }
+  if (controls) {
+    switch (controls[0]) {
+    case 'n':
+      control = 0;
+      break;
+    case 'r':
+      control = 1;
+      break;
+    case 'w':
+      control = 2;
+      break;
+    default:
+      fatal(MYNAME
+            ": unrecognized value for 'controls'\n");
+      break;
+    }
+  }
+}
+
+static void
+rd_deinit()
+{
+  gbfclose(infile);
+}
+
+static void
+my_read()
+{
+  static int serial = 0;
+  struct ll {
+    int32_t lat;
+    int32_t lon;
+  } *latlon;
+  struct ll mylatlon;
+  route_head* track_head = nullptr;
+  Waypoint* wpt_tmp;
+  char* routename = nullptr;
+  double seglen = 0.0;
+  int32_t  starttime = 0;
+  int32_t  transittime = 0;
+  double totaldist = 0.0;
+  double oldlat = 0;
+  double oldlon = 0;
+
+  ReadShort(infile);           /* magic */
+  uint16_t version = ReadShort(infile);
+
+  ReadLong(infile);
+  if (version >= 6) {
+    ReadLong(infile);
+    ReadLong(infile);
+  }
+
+  /*
+   * end of header
+   */
+
+  ReadShort(infile);
+  uint32_t recsize = ReadLong(infile);
+  /*
+   * the first recsize, oddly, doesn't include the filename string
+   * but it does include the header.
+   */
+  unsigned char* record = ReadRecord(infile, recsize);
+
+  uint16_t stringlen = le_read16((uint16_t*)(record + 0x1a));
+  if (stringlen) {
+    routename = (char*)xmalloc(stringlen + 1);
+    routename[stringlen] = '\0';
+    memcpy(routename, record+0x1c, stringlen);
+  }
+  Skip(infile, stringlen - 4);
+  xfree(record);
+
+  /*
+   * end of filename record
+   */
+
+  /*
+   * here lie the route description records
+   */
+  if (version < 6 || (control == 1)) {
+    track_head = new route_head;
+    route_add_head(track_head);
+    if (control) {
+      track_head->rte_name = "control points";
+    } else {
+      track_head->rte_name = routename;
+    }
+  }
+  uint32_t count = ReadLong(infile);
+  while (count) {
+    ReadShort(infile);
+    recsize = ReadLong(infile);
+    if (version < 6 || control) {
+      record = ReadRecord(infile, recsize);
+      latlon = (struct ll*)(record);
+
+      /* These records are backwards for some reason */
+      double lat = (0x80000000UL -
+        le_read32(&latlon->lon)) / (double)(0x800000);
+      double lon = (0x80000000UL -
+        le_read32(&latlon->lat)) / (double)(0x800000);
+
+      wpt_tmp = new Waypoint;
+      wpt_tmp->latitude = lat;
+      wpt_tmp->longitude = -lon;
+      if (control) {
+        int obase;
+
+        /* Somewhere around TopoUSA 6.0, these moved  */
+        /* This block also seems to get miscompiled
+         * at -O0 on Linux.  I tried rewriting it to
+         * reduce/eliminate some of the really funky
+         * pointer math and casting that was here.
+         */
+        if (version >= 11) {
+          obase = 20;
+        } else {
+          obase = 18;
+        }
+
+        int addrlen = le_read16(&record[obase]);
+        int cmtlen = le_read16(&record[obase+2+addrlen]);
+        (void) cmtlen;
+        // That we've had no bugreports on this strongly indicates this code
+        // is never used... Look in revision history if anyone cares.
+        wpt_tmp->shortname = "booger";
+        wpt_tmp->notes = "goober";
+      } else {
+        wpt_tmp->shortname = QString::asprintf("\\%5.5x", serial++);
+      }
+      if (control == 2) {
+        waypt_add(wpt_tmp);
+      } else {
+        route_add_wpt(track_head, wpt_tmp);
+      }
+      xfree(record);
+      if (version >= 6) {
+        /*
+             * two longs of scrap after each record, don't know why
+         */
+        ReadLong(infile);
+        ReadLong(infile);
+      }
+    } else {
+      Skip(infile, recsize);
+      /*
+       * two longs of scrap after each record, don't know why
+       */
+      ReadLong(infile);
+      ReadLong(infile);
+    }
+    count--;
+  }
+  /*
+   * end of route desc records
+   */
+
+  /*
+   * outercount is the number of route segments (start+end+stops+vias-1)
+   */
+
+  uint32_t outercount = ReadLong(infile);
+  while (outercount) {
+
+    /*
+     * unknown record (route params?) lives here
+     */
+    ReadShort(infile);
+    recsize = ReadLong(infile);
+    Skip(infile, recsize);
+
+    /*
+     * end of unknown record
+     */
+
+    /*
+     * routing begins here
+     */
+    count = ReadLong(infile);
+    if (count) {
+      track_head = new route_head;
+      if (timesynth) {
+        track_add_head(track_head);
+      } else {
+        route_add_head(track_head);
+      }
+      if (routename && !split) {
+        track_head->rte_name = routename;
+      }
+    }
+    while (count) {
+      route_head* old_track_head = nullptr;
+      ReadShort(infile);
+      recsize = ReadLong(infile);
+      record = ReadRecord(infile, recsize);
+      stringlen = le_read16((uint16_t*)record);
+      if (split && stringlen) {
+        if (track_head->rte_waypt_ct()) {
+          old_track_head = track_head;
+          track_head = new route_head;
+          if (timesynth) {
+            track_add_head(track_head);
+          } else {
+            route_add_head(track_head);
+          }
+        } // end if
+        if (track_head->rte_name.isEmpty()) {
+          track_head->rte_name = "Track";
+        }
+      }
+
+      if (timesynth) {
+        seglen = le_read_double(
+                   record + 2 + stringlen + 0x08);
+        starttime = le_read32((uint32_t*)
+                              (record + 2 + stringlen + 0x30));
+        transittime = le_read32((uint32_t*)
+                                (record + 2 + stringlen + 0x10));
+        seglen *= kMilesPerKilometer; /* to miles */
+      }
+
+      uint16_t coordcount = le_read16((uint16_t*)
+        (record + 2 + stringlen + 0x3c));
+      latlon = (struct ll*)(record + 2 + stringlen + 0x3c + 2);
+      count--;
+      if (count) {
+        coordcount--;
+      }
+
+      int first = 1;
+
+      while (coordcount) {
+        wpt_tmp = new Waypoint;
+
+        // copy to make sure we don't violate alignment restrictions.
+        memcpy(&mylatlon,latlon,sizeof(mylatlon));
+        double lat = (0x80000000UL -
+            le_read32(&mylatlon.lat)) /
+          (double)(0x800000);
+        double lon = (0x80000000UL -
+            le_read32(&mylatlon.lon)) /
+          (double)(0x800000);
+
+        wpt_tmp->latitude = lat;
+        wpt_tmp->longitude = -lon;
+        if (stringlen && ((coordcount>1) || count)) {
+          wpt_tmp->shortname = QString(((char*)record)+2);
+        } else {
+          wpt_tmp->shortname = QString::asprintf("\\%5.5x", serial++);
+        }
+        if (timesynth) {
+          if (!first) {
+            double dist = radtomiles(gcdist(
+                                       RAD(lat), RAD(-lon),
+                                       RAD(oldlat),
+                                       RAD(-oldlon)));
+            totaldist += dist;
+            if (totaldist > seglen) {
+              totaldist = seglen;
+            }
+            wpt_tmp->SetCreationTime(
+              gpsbabel_time+starttime+
+              transittime * totaldist/seglen);
+          } else {
+            wpt_tmp->SetCreationTime(gpsbabel_time+starttime);
+            totaldist = 0;
+          }
+          oldlat = lat;
+          oldlon = lon;
+        }
+        if (turns_important && stringlen) {
+          wpt_tmp->route_priority=1;
+        }
+        if (!turns_only || stringlen) {
+          if (timesynth) {
+            track_add_wpt(track_head,wpt_tmp);
+          } else {
+            route_add_wpt(track_head, wpt_tmp);
+          }
+          if (old_track_head) {
+            if (timesynth) {
+              track_add_wpt(old_track_head,
+                            new Waypoint(*wpt_tmp));
+            } else {
+              route_add_wpt(old_track_head,
+                            new Waypoint(*wpt_tmp));
+            }
+            old_track_head = nullptr;
+          }
+        }
+
+        latlon++;
+        coordcount--;
+        stringlen = 0;
+        /* the stop point is a "turn" */
+        if (coordcount == 1 && count == 0) {
+          stringlen = 1;
+        }
+        first = 0;
+      }
+      if (version > 10) {
+        Skip(infile,2*sizeof(uint32_t));
+      }
+      xfree(record);
+    }
+    /*
+     * end of routing
+     */
+    outercount--;
+  }
+  if (routename) {
+    xfree(routename);
+  }
+
+}
+
+ff_vecs_t saroute_vecs = {
+  ff_type_file,
+  { ff_cap_none, ff_cap_read, ff_cap_none},
+  rd_init,
+  nullptr,
+  rd_deinit,
+  nullptr,
+  my_read,
+  nullptr,
+  nullptr,
+  &saroute_args,
+  CET_CHARSET_UTF8, 1  /* do nothing | CET-REVIEW */
+  , NULL_POS_OPS
+};
index e87ab3a7ca7bcccc23bd7b84172f410bab219893..358f68b9e1ed7e04e5bfd06e4a0a7492d8e6e402 100644 (file)
@@ -6,7 +6,6 @@ iblue747        csv     Data Logger iBlue747 csv
 iblue757       csv     Data Logger iBlue757 csv
 gpl    gpl     DeLorme GPL
 saplus         DeLorme Street Atlas Plus
-saroute        anr     DeLorme Street Atlas Route
 destinator_itn dat     Destinator Itineraries (.dat)
 destinator_poi dat     Destinator Points of Interest (.dat)
 destinator_trl dat     Destinator TrackLogs (.dat)
index b041fb54876939bbaa0129f8ec18766613c10483..eff0629bb30feca08ca2d523104749e34608d0a4 100644 (file)
@@ -9,7 +9,6 @@ file    iblue747        csv     Data Logger iBlue747 csv
 file   iblue757        csv     Data Logger iBlue757 csv
 file   gpl     gpl     DeLorme GPL
 file   saplus          DeLorme Street Atlas Plus
-file   saroute anr     DeLorme Street Atlas Route
 file   destinator_itn  dat     Destinator Itineraries (.dat)
 file   destinator_poi  dat     Destinator Points of Interest (.dat)
 file   destinator_trl  dat     Destinator TrackLogs (.dat)
index 4d37d6469b7582bc0fb3b6d16505c09443679986..79de41b509f1c39797f3f75575d3ad50bd67653b 100644 (file)
@@ -9,7 +9,6 @@ file    --rw--  iblue747        csv     Data Logger iBlue747 csv
 file   --rw--  iblue757        csv     Data Logger iBlue757 csv
 file   --rw--  gpl     gpl     DeLorme GPL
 file   rw----  saplus          DeLorme Street Atlas Plus
-file   --r---  saroute anr     DeLorme Street Atlas Route
 file   ----rw  destinator_itn  dat     Destinator Itineraries (.dat)
 file   rw----  destinator_poi  dat     Destinator Points of Interest (.dat)
 file   --rw--  destinator_trl  dat     Destinator TrackLogs (.dat)
index 37282d4340b5c7fd783d361386f40b4e08d838b8..56a2c2738b5ff8480bb158c1a79a3eaba56cc2e1 100644 (file)
@@ -134,18 +134,6 @@ option     saplus  prefer_shortnames       Use shortname instead of description    boolean
 
 option saplus  datum   GPS datum (def. WGS 84) string                          https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saplus.html#fmt_saplus_o_datum
 
-file   --r---  saroute anr     DeLorme Street Atlas Route      saroute
-       https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saroute.html
-option saroute turns_important Keep turns if simplify filter is used   boolean                         https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saroute.html#fmt_saroute_o_turns_important
-
-option saroute turns_only      Only read turns; skip all other points  boolean                         https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saroute.html#fmt_saroute_o_turns_only
-
-option saroute split   Split into multiple routes at turns     boolean                         https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saroute.html#fmt_saroute_o_split
-
-option saroute controls        Read control points as waypoint/route/none      string  none                    https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saroute.html#fmt_saroute_o_controls
-
-option saroute times   Synthesize track times  boolean                         https://www.gpsbabel.org/WEB_DOC_DIR/fmt_saroute.html#fmt_saroute_o_times
-
 file   ----rw  destinator_itn  dat     Destinator Itineraries (.dat)   destinator_itn
        https://www.gpsbabel.org/WEB_DOC_DIR/fmt_destinator_itn.html
 file   rw----  destinator_poi  dat     Destinator Points of Interest (.dat)    destinator_poi
index 82ad34032c5e1e0dfcd83bffcd290511eae804ea..9cf3fe02e1a69735efdb588da3fb2f2be1aa1250 100644 (file)
@@ -75,12 +75,6 @@ File Types (-i and -o options):
          urlbase               Basename prepended to URL on output 
          prefer_shortnames     (0/1) Use shortname instead of description 
          datum                 GPS datum (def. WGS 84) 
-       saroute               DeLorme Street Atlas Route
-         turns_important       (0/1) Keep turns if simplify filter is used 
-         turns_only            (0/1) Only read turns; skip all other points 
-         split                 (0/1) Split into multiple routes at turns 
-         controls              Read control points as waypoint/route/none 
-         times                 (0/1) Synthesize track times 
        destinator_itn        Destinator Itineraries (.dat)
        destinator_poi        Destinator Points of Interest (.dat)
        destinator_trl        Destinator TrackLogs (.dat)
diff --git a/saroute.cc b/saroute.cc
deleted file mode 100644 (file)
index 24086a0..0000000
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
-    Read various Delorme routes including anr, rte, and rtd.
-
-    Copyright (C) 2003 Ron Parker and Robert Lipe.
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-
- */
-
-
-#define MYNAME "saroute"
-#include "defs.h"
-#include "grtcirc.h"
-#include <cstddef>
-
-static gbfile* infile;
-
-static char* turns_important = nullptr;
-static char* turns_only = nullptr;
-static char* controls = nullptr;
-static char* split = nullptr;
-static char* timesynth = nullptr;
-
-static int control = 0;
-
-static
-QVector<arglist_t> saroute_args = {
-  {
-    "turns_important", &turns_important,
-    "Keep turns if simplify filter is used",
-    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
-  },
-  {
-    "turns_only", &turns_only, "Only read turns; skip all other points",
-    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
-  },
-  {
-    "split", &split, "Split into multiple routes at turns",
-    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
-  },
-  {
-    "controls", &controls, "Read control points as waypoint/route/none",
-    "none", ARGTYPE_STRING, ARG_NOMINMAX, nullptr
-  },
-  {
-    "times", &timesynth, "Synthesize track times",
-    nullptr, ARGTYPE_BOOL, ARG_NOMINMAX, nullptr
-  },
-};
-
-#define ReadShort(f) gbfgetint16(f)
-#define ReadLong(f) gbfgetint32(f)
-
-static unsigned char*
-ReadRecord(gbfile* f, gbsize_t size)
-{
-  auto* result = (unsigned char*) xmalloc(size);
-
-  (void)gbfread(result, size, 1, f);
-  return result;
-}
-
-static void
-Skip(gbfile* f, gbsize_t distance)
-{
-  gbfseek(f, distance, SEEK_CUR);
-}
-
-static void
-rd_init(const QString& fname)
-{
-  infile = gbfopen(fname, "rb", MYNAME);
-  if (split && (turns_important || turns_only)) {
-    fatal(MYNAME
-          ": turns options are not compatible with split\n");
-  }
-  if (controls) {
-    switch (controls[0]) {
-    case 'n':
-      control = 0;
-      break;
-    case 'r':
-      control = 1;
-      break;
-    case 'w':
-      control = 2;
-      break;
-    default:
-      fatal(MYNAME
-            ": unrecognized value for 'controls'\n");
-      break;
-    }
-  }
-}
-
-static void
-rd_deinit()
-{
-  gbfclose(infile);
-}
-
-static void
-my_read()
-{
-  static int serial = 0;
-  struct ll {
-    int32_t lat;
-    int32_t lon;
-  } *latlon;
-  struct ll mylatlon;
-  route_head* track_head = nullptr;
-  Waypoint* wpt_tmp;
-  char* routename = nullptr;
-  double seglen = 0.0;
-  int32_t  starttime = 0;
-  int32_t  transittime = 0;
-  double totaldist = 0.0;
-  double oldlat = 0;
-  double oldlon = 0;
-
-  ReadShort(infile);           /* magic */
-  uint16_t version = ReadShort(infile);
-
-  ReadLong(infile);
-  if (version >= 6) {
-    ReadLong(infile);
-    ReadLong(infile);
-  }
-
-  /*
-   * end of header
-   */
-
-  ReadShort(infile);
-  uint32_t recsize = ReadLong(infile);
-  /*
-   * the first recsize, oddly, doesn't include the filename string
-   * but it does include the header.
-   */
-  unsigned char* record = ReadRecord(infile, recsize);
-
-  uint16_t stringlen = le_read16((uint16_t*)(record + 0x1a));
-  if (stringlen) {
-    routename = (char*)xmalloc(stringlen + 1);
-    routename[stringlen] = '\0';
-    memcpy(routename, record+0x1c, stringlen);
-  }
-  Skip(infile, stringlen - 4);
-  xfree(record);
-
-  /*
-   * end of filename record
-   */
-
-  /*
-   * here lie the route description records
-   */
-  if (version < 6 || (control == 1)) {
-    track_head = new route_head;
-    route_add_head(track_head);
-    if (control) {
-      track_head->rte_name = "control points";
-    } else {
-      track_head->rte_name = routename;
-    }
-  }
-  uint32_t count = ReadLong(infile);
-  while (count) {
-    ReadShort(infile);
-    recsize = ReadLong(infile);
-    if (version < 6 || control) {
-      record = ReadRecord(infile, recsize);
-      latlon = (struct ll*)(record);
-
-      /* These records are backwards for some reason */
-      double lat = (0x80000000UL -
-        le_read32(&latlon->lon)) / (double)(0x800000);
-      double lon = (0x80000000UL -
-        le_read32(&latlon->lat)) / (double)(0x800000);
-
-      wpt_tmp = new Waypoint;
-      wpt_tmp->latitude = lat;
-      wpt_tmp->longitude = -lon;
-      if (control) {
-        int obase;
-
-        /* Somewhere around TopoUSA 6.0, these moved  */
-        /* This block also seems to get miscompiled
-         * at -O0 on Linux.  I tried rewriting it to
-         * reduce/eliminate some of the really funky
-         * pointer math and casting that was here.
-         */
-        if (version >= 11) {
-          obase = 20;
-        } else {
-          obase = 18;
-        }
-
-        int addrlen = le_read16(&record[obase]);
-        int cmtlen = le_read16(&record[obase+2+addrlen]);
-        (void) cmtlen;
-        // That we've had no bugreports on this strongly indicates this code
-        // is never used... Look in revision history if anyone cares.
-        wpt_tmp->shortname = "booger";
-        wpt_tmp->notes = "goober";
-      } else {
-        wpt_tmp->shortname = QString::asprintf("\\%5.5x", serial++);
-      }
-      if (control == 2) {
-        waypt_add(wpt_tmp);
-      } else {
-        route_add_wpt(track_head, wpt_tmp);
-      }
-      xfree(record);
-      if (version >= 6) {
-        /*
-             * two longs of scrap after each record, don't know why
-         */
-        ReadLong(infile);
-        ReadLong(infile);
-      }
-    } else {
-      Skip(infile, recsize);
-      /*
-       * two longs of scrap after each record, don't know why
-       */
-      ReadLong(infile);
-      ReadLong(infile);
-    }
-    count--;
-  }
-  /*
-   * end of route desc records
-   */
-
-  /*
-   * outercount is the number of route segments (start+end+stops+vias-1)
-   */
-
-  uint32_t outercount = ReadLong(infile);
-  while (outercount) {
-
-    /*
-     * unknown record (route params?) lives here
-     */
-    ReadShort(infile);
-    recsize = ReadLong(infile);
-    Skip(infile, recsize);
-
-    /*
-     * end of unknown record
-     */
-
-    /*
-     * routing begins here
-     */
-    count = ReadLong(infile);
-    if (count) {
-      track_head = new route_head;
-      if (timesynth) {
-        track_add_head(track_head);
-      } else {
-        route_add_head(track_head);
-      }
-      if (routename && !split) {
-        track_head->rte_name = routename;
-      }
-    }
-    while (count) {
-      route_head* old_track_head = nullptr;
-      ReadShort(infile);
-      recsize = ReadLong(infile);
-      record = ReadRecord(infile, recsize);
-      stringlen = le_read16((uint16_t*)record);
-      if (split && stringlen) {
-        if (track_head->rte_waypt_ct()) {
-          old_track_head = track_head;
-          track_head = new route_head;
-          if (timesynth) {
-            track_add_head(track_head);
-          } else {
-            route_add_head(track_head);
-          }
-        } // end if
-        if (track_head->rte_name.isEmpty()) {
-          track_head->rte_name = "Track";
-        }
-      }
-
-      if (timesynth) {
-        seglen = le_read_double(
-                   record + 2 + stringlen + 0x08);
-        starttime = le_read32((uint32_t*)
-                              (record + 2 + stringlen + 0x30));
-        transittime = le_read32((uint32_t*)
-                                (record + 2 + stringlen + 0x10));
-        seglen *= kMilesPerKilometer; /* to miles */
-      }
-
-      uint16_t coordcount = le_read16((uint16_t*)
-        (record + 2 + stringlen + 0x3c));
-      latlon = (struct ll*)(record + 2 + stringlen + 0x3c + 2);
-      count--;
-      if (count) {
-        coordcount--;
-      }
-
-      int first = 1;
-
-      while (coordcount) {
-        wpt_tmp = new Waypoint;
-
-        // copy to make sure we don't violate alignment restrictions.
-        memcpy(&mylatlon,latlon,sizeof(mylatlon));
-        double lat = (0x80000000UL -
-            le_read32(&mylatlon.lat)) /
-          (double)(0x800000);
-        double lon = (0x80000000UL -
-            le_read32(&mylatlon.lon)) /
-          (double)(0x800000);
-
-        wpt_tmp->latitude = lat;
-        wpt_tmp->longitude = -lon;
-        if (stringlen && ((coordcount>1) || count)) {
-          wpt_tmp->shortname = QString(((char*)record)+2);
-        } else {
-          wpt_tmp->shortname = QString::asprintf("\\%5.5x", serial++);
-        }
-        if (timesynth) {
-          if (!first) {
-            double dist = radtomiles(gcdist(
-                                       RAD(lat), RAD(-lon),
-                                       RAD(oldlat),
-                                       RAD(-oldlon)));
-            totaldist += dist;
-            if (totaldist > seglen) {
-              totaldist = seglen;
-            }
-            wpt_tmp->SetCreationTime(
-              gpsbabel_time+starttime+
-              transittime * totaldist/seglen);
-          } else {
-            wpt_tmp->SetCreationTime(gpsbabel_time+starttime);
-            totaldist = 0;
-          }
-          oldlat = lat;
-          oldlon = lon;
-        }
-        if (turns_important && stringlen) {
-          wpt_tmp->route_priority=1;
-        }
-        if (!turns_only || stringlen) {
-          if (timesynth) {
-            track_add_wpt(track_head,wpt_tmp);
-          } else {
-            route_add_wpt(track_head, wpt_tmp);
-          }
-          if (old_track_head) {
-            if (timesynth) {
-              track_add_wpt(old_track_head,
-                            new Waypoint(*wpt_tmp));
-            } else {
-              route_add_wpt(old_track_head,
-                            new Waypoint(*wpt_tmp));
-            }
-            old_track_head = nullptr;
-          }
-        }
-
-        latlon++;
-        coordcount--;
-        stringlen = 0;
-        /* the stop point is a "turn" */
-        if (coordcount == 1 && count == 0) {
-          stringlen = 1;
-        }
-        first = 0;
-      }
-      if (version > 10) {
-        Skip(infile,2*sizeof(uint32_t));
-      }
-      xfree(record);
-    }
-    /*
-     * end of routing
-     */
-    outercount--;
-  }
-  if (routename) {
-    xfree(routename);
-  }
-
-}
-
-ff_vecs_t saroute_vecs = {
-  ff_type_file,
-  { ff_cap_none, ff_cap_read, ff_cap_none},
-  rd_init,
-  nullptr,
-  rd_deinit,
-  nullptr,
-  my_read,
-  nullptr,
-  nullptr,
-  &saroute_args,
-  CET_CHARSET_UTF8, 1  /* do nothing | CET-REVIEW */
-  , NULL_POS_OPS
-};
diff --git a/testo.d/saroute.test b/testo.d/saroute.test
deleted file mode 100644 (file)
index a0f1961..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#
-# saroute covers *.anr, *.rte, and *.rtd, but I only have an .anr for testing.
-# Unfortunately for us, this is a read-only format for now.
-#
-gpsbabel -t -i saroute -f ${REFERENCE}/track/i65.anr -o gpx -F ${TMPDIR}/gpl1.gpx
-gpsbabel -t -i gpx -f ${REFERENCE}/track/i65.anr.gpx -o gpx -F ${TMPDIR}/gpl2.gpx
-compare ${TMPDIR}/gpl1.gpx ${TMPDIR}/gpl2.gpx
-
diff --git a/vecs.cc b/vecs.cc
index 580df72287fd54304734c35acb9a7718413d0959..c4efb0df621510f0d96f9b1ec401e84236835d05 100644 (file)
--- a/vecs.cc
+++ b/vecs.cc
@@ -89,7 +89,6 @@ extern ff_vecs_t tpg_vecs;
 extern ff_vecs_t tpo2_vecs;
 extern ff_vecs_t tpo3_vecs;
 extern ff_vecs_t easygps_vecs;
-extern ff_vecs_t saroute_vecs;
 extern ff_vecs_t gpl_vecs;
 extern ff_vecs_t igc_vecs;
 extern ff_vecs_t brauniger_iq_vecs;
@@ -171,7 +170,6 @@ struct Vecs::Impl
   LegacyFormat tpo2_fmt {tpo2_vecs};
   LegacyFormat tpo3_fmt {tpo3_vecs};
   LegacyFormat easygps_fmt {easygps_vecs};
-  LegacyFormat saroute_fmt {saroute_vecs};
 #if SHAPELIB_ENABLED
   ShapeFormat shape_fmt;
 #endif
@@ -380,13 +378,6 @@ struct Vecs::Impl
       "loc",
       nullptr,
     },
-    {
-      &saroute_fmt,
-      "saroute",
-      "DeLorme Street Atlas Route",
-      "anr",
-      nullptr,
-    },
 #if SHAPELIB_ENABLED
     {
       &shape_fmt,
diff --git a/xmldoc/formats/saroute.xml b/xmldoc/formats/saroute.xml
deleted file mode 100644 (file)
index a285a46..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<para>
-This format reads route files from many DeLorme mapping products.
-It supports the anr, rte, and rtd formats as either tracks or
-routes.</para>
-      <para> All options only apply to route files from newer (anr)
-versions of DeLorme software; older versions didn't store the turn
-information with the route.
-</para>
-